<?php get_instance()->view('common/header');?>
<style type="text/css">
	div .radio-inline:nth-child(2), div .checkbox-inline:nth-child(2) {
		margin-left: 10px;
	}
	.box:after{clear:both;conten:"";display:block;}
	.panel{border:0;}
	.panel-title{text-align:left; color:#36b3b3 !important;}
	.panel-title .btn{color:#fff;}
	.panel-body{padding:0;}
	.panel-default>.panel-heading{border:0;}
	.panel-heading{padding-left:9px;}
	.fa-pencil{}
	.table-bordered .dier td{color:#999;}
	.tablewu td{text-align:left;}
	.jine{color:#36b3b3; font-size:16px;}
    .panel-title .btn{
        position: relative;
        top:-2px;
    }
    .tablewu>thead>tr>td{border-bottom-width: 1px;}
    .match-body>li{padding: 5px}
    .match-body>li>span{margin-right: 10px}
    .warps-textCons {
        text-align: center;
        padding: 3em 0 1em 0;
    }
    .warps-textCons h1 {
        font-size: 1.4em;
        color: #666;
        margin: 1em 0 0.65em 0;
        font-weight: 100;
    }
</style>
<div class="page-container">
	<!-- BEGIN SIDEBAR -->
    <?php get_instance()->view('common/sidebar');?>
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title"> <?php echo $title?> </h3>
					<ul class="page-breadcrumb breadcrumb">
						<li class="btn-group">
						<a  href="<?php echo $backUrl?>" class="btn default"><i class="fa fa-chevron-left"></i> 返回</a> </li>
						<li> <a href="javascript:;"> 商品管理 </a> <i class="fa fa-angle-right"></i> </li>
						<li> <a href="<?php echo $backUrl?>"> 订单列表 </a> <i class="fa fa-angle-right"></i></li>
						<li> <?php echo $title?></li>
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <!--新订单列表 基本信息-->
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title text-center">基本信息</h3>
                            </div>
                            <div class="panel-body">
                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td>ID</td>
                                            <td>订单号</td>
                                            <td>商家</td>
                                            <td>会员</td>
                                            <td>电话</td>
                                            <td>应付</td>
                                            <td>订单状态</td>
                                            <td>下单时间</td>
                                            <td>支付时间</td>
                                            <td>支付方式</td>
                                        </tr>
                                        <tr class="dier">
                                            <td><?php echo $info['id']?></td>
                                            <td><?php echo $info['code']?></td>
                                            <td><?php echo $info['merchant']?></td>
                                            <td><?php echo $info['consumer']?></td>
                                            <td><?php echo $info['consumer_mobile']?></td>
                                            <td><?php echo $info['reality_amount']?></td>
                                            <td class="status-str"><?php echo $info['status_format_str']?></td>
                                            <td><?php echo $info['addtime']?></td>
                                            <td><?php echo $info['pay_time']?></td>
                                            <td><?php echo $info['pay_type_str']?></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <!--收货人信息-->
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title text-center">
                                    收货信息
                                </h3>
                            </div>
                            <div class="panel-body">
                                <table class="table table-bordered tablewu">
                                    <tbody>
                                        <tr>
                                            <td>收货人</td>
                                            <td>联系方式</td>
                                            <td>区域</td>
                                            <td>详细地址</td>
                                            <td>配送方式</td>
                                        </tr>
                                        <tr class="dier address-list">
                                            <td><?php echo $info['contacts']?></td>
                                            <td><?php echo $info['mobile']?></td>
                                            <td><?php echo $info['province'].' - '.$info['city'].' - '.$info['county']?></td>
                                            <td><?php echo $info['address']?></td>
                                            <td><?php echo $info['expense_type_str']?></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <!--商品信息-->
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title text-center">
                                    商品信息
                                </h3>
                            </div>
                            <div class="panel-body">
                                <table class="table table-bordered tablewu">
                                    <thead>
                                        <tr>
                                            <td class="text-left">商品</td>
                                            <td class="text-left">规格</td>
                                            <td class="text-right">数量</td>
                                            <td class="text-right">单品价格</td>
                                            <td class="text-right">单品小计</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                            <tr class="dier">
                                                <td class="text-left"><?php echo $oP['name']?></td>
                                                <td class="text-left"><?php echo $oP['property']?></td>
                                                <td class="text-right"><?php echo $oP['quantity']?></td>
                                                <td class="text-right">￥<?php echo $oP['price']?></td>
                                                <td class="text-right">￥<?php echo round($oP['price']*$oP['quantity'], 2)?></td>
                                            </tr>
                                        <tr>
                                            <td colspan="5" class="text-right">商品合计:<label class="jine">￥<?php echo $info['product_amount']?></label></td>
                                        </tr>
                                        <tr>
                                            <td colspan="5" class="text-right">备注:<label class="jine"><?php echo $info['remark']?></label></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                         <!--新订单列表 费用信息-->
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title text-center">费用信息</h3>
                            </div>
                            <div class="panel-body">
                                <table class="table table-bordered">
                                    <tbody>
                                    <tr>
                                        <td colspan="5" class="text-right">商品总金额：￥<?php echo $info['product_amount']?><?php if (isset($info['param']['freight'])) echo '+配送费:￥'.$info['param']['freight']; unset($info['param']['freight']);?></td>
                                    </tr>
                                    <tr>
                                        <td class="text-right">= 订单总金额：<label class="jine">￥<?php echo $info['total_amount']?></label></td>
                                    </tr>
                                    <?php if (!empty($info['param'])):?>
                                        <tr>
                                            <td class="text-right">
                                                <?php foreach ($info['param'] as $k => $v):
                                                if ($k == 'red_packet'){ echo "-红包：￥".$v;}
                                                if ($k == 'voucher'){ echo "-代金券：￥".$v;}
                                                if ($k == 'first_order_reduce'){ echo "-商家首单减免：￥".$v;}
                                                if ($k == 'full_cut'){ echo "-满减：￥".$v;}
                                                 endforeach;?>
                                            </td>
                                        </tr>
                                    <?php endif;?>
                                    <tr>
                                        <td class="text-right">= 应付款金额：<label class="jine">￥<?php echo $info['reality_amount']?></label></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <!--售后操作-->
                        <div class="panel panel-default" id="save-modal">
                            <div class="panel-heading">
                                <h3 class="panel-title text-center">售后信息</h3>
                            </div>
                            <div class="panel-body">
                                <form action="<?php echo getUrl('order/service/saveService')?>" class="form-horizontal" id="save-form" method="post" novalidate="novalidate">
                                    <div class="modal-body" style="max-height: 654px;">
                                        <div class="form-group" type="select_field_type">
                                            <label class="control-label col-md-3">订单号：</label>
                                            <div class="col-md-9 text-shop_score text"><?php echo $serviceInfo['code']?></div>
                                        </div>
                                        <div class="form-group" type="select_field_type">
                                            <label class="control-label col-md-3">申请时间：</label>
                                            <div class="col-md-9 text-shop_score text"><?php echo $serviceInfo['addtime']?></div>
                                        </div>
                                        <div class="form-group" type="select_field_type">
                                            <label class="control-label col-md-3">退款金额：</label>
                                            <?php if ($serviceInfo['status'] == 2):?>
                                                <div class="col-md-9 text-shop_score text"><?php echo $serviceInfo['refund_amount']?></div>
                                            <?php else:?>
                                                <div class="col-md-6 reality-amount">
                                                    <input class="form-control form-filter" type="tel" value="<?php echo $serviceInfo['refund_amount']?>" name="refund_amount">
                                                    <span>退款金额最多为：<span class="yuan"><?php echo $oP['reality_amount']?></span>（元）</span>
                                                </div>
                                            <?php endif;?>
                                        </div>
                                        <div class="form-group" type="select_field_type">
                                            <label class="control-label col-md-3">退货状态：</label>
                                            <div class="col-md-9 text-shop_score text status-format-str"><?php echo $serviceInfo['status_format_str']?></div>
                                        </div>
                                        <div class="form-group" type="select_field_type">
                                            <label class="control-label col-md-3">退货原因：</label>
                                            <div class="col-md-6">
                                                <textarea rows="5" cols="5" class="form-control" readonly><?php echo $serviceInfo['remark']?></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-3">商家备注：</label>
                                            <div class="col-md-6">
                                                <textarea rows="5" cols="5" class="form-control required" name="complete_remark" readonly><?php echo $serviceInfo['complete_remark']?></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-3">平台备注：</label>
                                            <div class="col-md-6">
                                                <textarea rows="5" cols="5" class="form-control required" name="platform_remark" <?php if ($serviceInfo['status'] == 2):?> readonly <?php endif;?>><?php echo $serviceInfo['platform_remark']?></textarea>
                                            </div>
                                        </div>
                                        <div <?php if ($serviceInfo['status'] < 3):?> class="form-group complete-time" <?php else:?> class="form-group complete-time hide" <?php endif;?> >
                                            <label class="control-label col-md-3">处理时间：</label>
                                            <div class="col-md-9 text-shop_score text"><?php echo $serviceInfo['complete_time']?></div>
                                        </div>
                                        <div class="col-md-offset-3 col-md-8">
                                            <?php if ($serviceInfo['status'] != 2):?>
                                                <input type="hidden" name="code" value="<?php echo $serviceInfo['code']?>" class="re">
                                                <input type="hidden" name="status" class="re">
                                                <input type="submit" class="field-submit-btn re hide" data-dismiss="modal" aria-hidden="true">
                                                <a class="btn green-stripe default re ajax-request-btn" alert-message="是否确认退款？" data-status="2" >确认退款</a>
                                            <?php endif; if ($serviceInfo['status'] == 3):?>
                                                <a class="btn red-stripe default refuse ajax-request-btn" alert-message="是否确认拒绝退款？" data-status="4" >拒绝</a>
                                            <?php endif;?>
                                            <a href="<?php echo $backUrl?>" class="btn default"><i class="fa fa-chevron-left"></i> 返回</a>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
		</div>
	</div>
	<!-- END CONTENT -->
</div>
<script type="text/javascript">
    $(function () {
        var modal = $("#save-modal");

        $(".ajax-request-btn").live('click',function () {
            var message = $(this).attr('alert-message');
            var status = $(this).attr('data-status');
            confirmMessage({
                info:message,
                confirmCallback:function(){
                    modal.find("[name='status']").val(status);
                    $(".field-submit-btn").click();
                }
            });
            return false;
        });

        $.e_validate.init('#save-form',{modal:modal,ignore:'',successCallback:function(data){
            modal.find(".complete-time").find('div').html(data.complete_time);
            modal.find(".complete-time").removeClass('hide');
            modal.find(".status-format-str").html(data.status_format_str);
            modal.find('.refuse').remove();
            if (data.status === 2){
                modal.find("[name='platform_remark']").attr('readonly', 'readonly');
                var realityAmount = modal.find('[name="refund_amount"]').val();
                modal.find(".reality-amount").html(realityAmount);
                modal.find(".reality-amount").addClass('col-md-9 text-shop_score text');
                modal.find(".reality-amount").removeClass('col-md-6');
                modal.find('.re').remove();
            }
        }});
    })
</script>
</body>
</html>